Model trains can be controlled by various electronic means. The most popular system is called DCC (Digital Command and Control) and is a standard set by NMRA (National Model Railroad Association). There are also various RF and other protocols.
Existing controls are primarily one-way communication systems. Commands are sent to a decoder in the locomotive or rolling stock. Each decoder has an address, and specific commands can be sent to that decoder. Generally, a human operator is watching the layout and controlling the various trains on the layout. However, it is difficult to determine the physical location of the train on the layout by any electronic means. This makes computer control of model railroad signals and routing of switches and other trains very difficult.